import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace AiBotTagApi {
  /** 机器人智能体标签信息 */
  export interface BotTag {
    id: number; // 机器人标签ID
    name?: string; // 标签名称
    icon: string; // 标签图标
    color: string; // 颜色
    sort: number; // 排序
    systemFlag?: boolean; // 是否系统内置
    botCount: number; // 机器人个数
  }
}

/** 查询机器人智能体标签分页 */
export function getBotTagPage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<PageResult<AiBotTagApi.BotTag>>(
    '/ai/bot-tag/page',
    data,
    { desensitize, encrypt },
  );
}

/** 查询机器人智能体标签详情 */
export function getBotTag(id: number) {
  return requestClient.get<AiBotTagApi.BotTag>(`/ai/bot-tag/get?id=${id}`);
}

/** 新增机器人智能体标签 */
export function createBotTag(data: AiBotTagApi.BotTag) {
  return requestClient.post('/ai/bot-tag/create', data);
}

/** 修改机器人智能体标签 */
export function updateBotTag(data: AiBotTagApi.BotTag) {
  return requestClient.put('/ai/bot-tag/update', data);
}

/** 删除机器人智能体标签 */
export function deleteBotTag(id: number) {
  return requestClient.delete(`/ai/bot-tag/delete?id=${id}`);
}

/** 批量删除机器人智能体标签 */
export function deleteBotTagList(ids: number[]) {
  return requestClient.delete(`/ai/bot-tag/delete-list?ids=${ids.join(',')}`);
}

/** 导出机器人智能体标签 */
export function exportBotTag(params: any) {
  return requestClient.download('/ai/bot-tag/export-excel', { params });
}
